/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package merlion.common.session.stateless;

import java.util.Collection;
import javax.ejb.Remote;
import merlion.common.entity.AccessRight;
import merlion.common.entity.SecurityRole;
import merlion.common.entity.Staff;
import merlion.common.entity.SystemUserAccount;
import merlion.common.util.exception.EntityExistException;
import merlion.common.util.exception.NotExistException;
import merlion.common.util.exception.UpdateFailureException;

/**
 *
 * @author Zhang Ying
 */
@Remote
public interface SystemUserSessionBeanRemote {

    Staff activateSytemUserAccount(SystemUserAccount sua) throws UpdateFailureException;

    Long addNewSecurityRole(String roleName, String department, Collection<AccessRight> selectedRights) throws EntityExistException;

    void addNewStaff(Staff newStaff) throws EntityExistException;

    boolean checkAccountDisabled(String emailInputed);

    boolean checkAccountStatusActivated(String username);

    boolean checkEmailExist(String emailInputed);

    boolean checkRolenameExist(String nameInputed);

    boolean checkSecureAnswer(String email, String ans);

    boolean checkSystemUserAccountMatch(String username, String unencryptedPassword);

    boolean checkSystemUserAccountMatchDisabled(String username, String unencryptedPassword);

    boolean checkUsernameExist(String username);

    SystemUserAccount deactivateSystemUserAccount(String staffUsername);

    Long deleteSecurityRole(Long id) throws NotExistException;

    void deleteSystemUserAccount(Long id) throws NotExistException;

    AccessRight getAccessRight(Long id);

    Collection<AccessRight> getAllAccessRights();

    Collection<String> getAllDepartments();

    Collection<SecurityRole> getAllSecurityRoles();

    Collection<Staff> getAllStaff();

    Collection<Staff> getAllStaffbyDepartment(String department);

    Collection<SystemUserAccount> getAllSystemUserAccounts();

    Collection<SystemUserAccount> getFilteredAccounts(String rolename);

    String getSecureQuestion(String email);

    SecurityRole getSecurityRole(Long id);

    Staff getStaff(String accountUsername) throws NotExistException;

    Staff getStaff(Long id);

    Collection<AccessRight> getStaffAccessRights(String staffUsername);

    SystemUserAccount getSystemUserAccount(Long id);

    SystemUserAccount getSystemUserAccount(String email);

    boolean isAbleToDeleteRole(SecurityRole selectedRole);

    boolean isTokenValid(String token);

    void updateCurrentStaffInfo(Staff currentStaff) throws UpdateFailureException;

    void updateLoginTime(String staffUsername);

    Long updateSecurityRole(SecurityRole newRole) throws UpdateFailureException;

    Long updateSecurityRole(SecurityRole newRole, Collection<AccessRight> updateAccessRights) throws UpdateFailureException;

    void updateStaffToken(String staffUsername, String token) throws UpdateFailureException;

    void updateSystemUserAccount(SystemUserAccount sua, Collection<SecurityRole> updatedSecuirtyRoles) throws UpdateFailureException;

    void updateSystemUserAccount(SystemUserAccount sua) throws UpdateFailureException;

    SystemUserAccount updateSystemUserAccountStatus(String token) throws UpdateFailureException;
    
    SecurityRole getSecurityRole(String roleName);
    
}
